home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / bbs / WWBBSDoors.lha / WWBBS / rexxDoors / FilmFlubs.rexx < prev    next >
OS/2 REXX Batch file  |  1995-04-25  |  2KB  |  59 lines

  1. /*  $VER: 1.0  FilmFlubs.rexx  15 October 1991  (15.10.91)
  2.             copyright 1991 Richard Lee Stockton
  3.                   FREELY DISTRIBUTABLE
  4. */
  5.  
  6. FF='0C'x  /* FormFeed */
  7. CR='0D'x  /* Carraige Return */
  8. SIGNAL ON BREAK_C
  9. SIGNAL ON BREAK_E
  10.  
  11. ARG name .
  12.  
  13. /* Open the support library if it is not already open. */
  14. if ~show('L',"rexxsupport.library") then do
  15.     addlib('rexxsupport.library',0,-30,0)
  16.      end
  17.  
  18. bbspath=GETCLIP('BBS_path')
  19. filename=bbspath'rexxDoors/Data/FilmFlubs.txt'  /* Formfeed separated text */
  20. size=WORD(STATEF(filename),2)
  21. fragment=size/3000
  22.  
  23. x=OPEN(f,'RAM:DUMMY','W')                /* write to a dummy file */
  24. IF x=0 THEN EXIT(20);
  25. CALL WRITELN(f,'dummy')
  26. CALL CLOSE(f)
  27. micros=WORD(STATEF('RAM:DUMMY'),7)        /*  0 >= micros < 3000  */
  28. location=fragment*micros
  29. IF fragment>1000 THEN
  30.   location=location+fragment*RIGHT(TIME('S'),2)/100
  31. ELSE IF fragment>100 THEN
  32.   location=location+fragment*RIGHT(TIME('S'),1)/10
  33. location=TRUNC(location)
  34. IF location>size THEN location=micros
  35.  
  36. x=OPEN(f,filename,'R')
  37. IF x=0 THEN RETURN(10);
  38. CALL SEEK(f,location,'B')            /* point to the random place */
  39. line=''
  40. DO WHILE line~=FF & ~EOF(f)        /* find the start (a formfeed) */
  41.   line=READLN(f)
  42. END
  43. count=0
  44. line=''
  45. IF ~EOF(f) THEN      /* if EOF then must be right at end. missed! */
  46.   DO WHILE line~=FF & ~EOF(f)         /* otherwise, show the page */
  47.     line=READLN(f)
  48.     IF ~EOF(f) & line~=FF THEN
  49.       DO
  50.         SAY line||CR
  51.         count=count+1
  52.       END
  53.   END
  54. BREAK_C:
  55. BREAK_E:
  56. CALL CLOSE(f)
  57. RETURN(count);
  58. EXIT;                           /* a little redundant, so sue me! */
  59.